const mongoose=require('./db')
const loginSchema=new mongoose.Schema({
    username:String,
    password:String
})


const shoptypeSchema=new mongoose.Schema({
    name:String
})

const shopSchema=new mongoose.Schema({
    name:String,
    imgpath:String,
    content:String,
    price:Number,
    num:Number,
    pid:{
        type:mongoose.Types.ObjectId,
        ref:'shop'
    }
})

const pingSchema=new mongoose.Schema({
    name:String,
})
const pinglunSchema=new mongoose.Schema({
    name:String,
    avaimgpath:String,//头像
    content:String,
    pid:{
        type:mongoose.Types.ObjectId,
        ref:'ping'
    }
})
const loginModel=mongoose.model('login',loginSchema,'login')
const shoptypeModel=mongoose.model('shoptype',shoptypeSchema,'shoptype')
const   pinglunModel=mongoose.model('pinglin',pinglunSchema,'pinglun')
const pingModel=mongoose.model('ping',pingSchema,'ping')
const shopModel=mongoose.model('shop',shopSchema,'shop')
module.exports={loginModel,shoptypeModel,shopModel,pingModel,pinglunModel}